<?php
	$mail = $_POST['mail'];
	$password = $_POST['password'];
	
	$return = Array();
	
	$_user = new User($mail, "mail");
	
	if($_user->getID() == 0){
		$return['result'] = false;
		$return['message'] = "ipt_connectionMail";
	}else{
		if(md5($password) != $_user->getPassword()){
			$return['result'] = false;
			$return['message'] = "ipt_connectionPassword";
		}else{
			$_session = new Session();
			$_session->setUser($_user);
			
			$return['result'] = true;
			$return['message'] = "OK";
		}
	}
	
	echo json_encode($return);